from django.db import models

# Create your models here.
from django.db.models import *


# 用户的账户信息表
class AccountNumber(models.Model):
    account = models.CharField(max_length=16, unique=True)
    userName = models.CharField(max_length=16)
    password = models.CharField(max_length=16)
    telephone = models.CharField(max_length=11, null=True)
    # touxiang = models.ImageField(max_length=100,default=)


# 历史文化介绍数据库
class HistoryCulture(models.Model):
    dynasty = models.CharField(max_length=16)
    summury = models.TextField()
    # image = models.CharField(max_length=30,default=None)


# 文学作品数据库
class AllBook(models.Model):
    author = models.CharField(max_length=16, unique=False)
    bookName = models.CharField(max_length=50, unique=False)
    pReason = models.CharField(max_length=100, unique=False, null=True)  # 这是未通过的原因
    bookContent = models.TextField(default=None)
    translation = models.TextField(default=None)
    intro = models.TextField(default=None)
    dynasty = models.CharField(max_length=16)
    checkBool = models.IntegerField(default=2)  # 1是通过 2是未审核 3是未通过
    upAccount = models.ForeignKey(to='AccountNumber', on_delete=True)


# 作品评论数据库
class Comment(models.Model):
    bookName = models.ForeignKey(to='AllBook', on_delete=True)
    account = models.CharField(max_length=16)
    commentContent = models.TextField()
    commenttime = models.DateTimeField(auto_now=True)


# 文化评论ID
class CultureComment(models.Model):
    CultureOb = models.ForeignKey(to='HistoryCulture', on_delete=True)
    account = models.CharField(max_length=16)
    commentContent = models.TextField()
    commenttime = models.DateTimeField(auto_now=True)
